﻿using GC_FFW.BusinessEntities.Enums.Forecast;
using GC_FFW.BusinessEntities.Extensions.Enums.Forecast;
using GC_FFW.Common.Extensions;
using System.ComponentModel;

namespace GC_FFW.ForecastWriterClient.ViewModels
{
	public class CoefficientsViewModelItem : INotifyPropertyChanged
	{
		#region Variables

		private string _valueOne;
		private string _valueSecond;

		#endregion

		#region Properties

		public CoefficientType Type { get; set; }

		public string Name
		{
			get
			{
				return Type.CoefficientName();
			}
		}

		public string ValueOne
		{
			get
			{
				return (_valueOne ?? string.Empty).ToValidDoubleFormat();
			}
			set
			{
				_valueOne = value;
				if (PropertyChanged == null) return;
				PropertyChanged(this, new PropertyChangedEventArgs("ValueOne"));
			}
		}

		public string ValueSecond
		{
			get
			{
				return (_valueSecond ?? string.Empty).ToValidDoubleFormat();
			}
			set
			{
				_valueSecond = value;
				if (PropertyChanged == null) return;
				PropertyChanged(this, new PropertyChangedEventArgs("ValueSecond"));
			}
		}

		#endregion

		#region INotifyPropertyChanged Members

		public event PropertyChangedEventHandler PropertyChanged;

		protected virtual void OnPropertyChanged(string propertyName)
		{
			var handler = PropertyChanged;
			if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
		}

		#endregion
	}
}
